{% extends 'index.html' %}
{% block main-content %}
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">课室管理</h3>
        </div>
    </div>
    <br>
    <form class="col-md-11" style="width: 100%;margin-top: 20px;left: 30px" method="post">
        <div class="form-group form-inline">
            <label for="course_select">课&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;程</label>&nbsp;
            <select name="course_select" id="course_select" class="form-control" style="width:150px;height: 50px">
                <option value="" selected>请选择课程名称</option>
                {% for keshi02_obj in keshi_queryset %}
                    {% if keshi02_obj.coursename %}
                        <option value="{{ keshi02_obj.coursename }}" selected>{{ keshi02_obj.coursename }}</option>
                    {% else %}
                        <option value="{{ keshi02_obj.coursename }}">{{ keshi02_obj.coursename }}</option>
                    {% endif %}
                {% endfor %}
            </select>&nbsp;&nbsp;
            <label for="class_select">课&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;室</label>&nbsp;
            <select name="class_select" id="class_select" class="form-control" style="width:150px;height: 50px">
                <option value="" selected>请选择课室名称</option>
                {% for keshi02_obj in keshi_queryset %}
                    {% if keshi02_obj.classroomnum %}
                        <option value="{{ keshi02_obj.classroomnum }}" selected>{{ keshi02_obj.classroomnum }}</option>
                    {% else %}
                        <option value="{{ keshi02_obj.classroomnum }}">{{ keshi02_obj.classroomnum }}</option>
                    {% endif %}
                {% endfor %}
            </select>&nbsp;&nbsp;
            <label for="studentnum">学生人数</label>&nbsp;
            <input type="text" class="form-control" id="studentnum" placeholder="输入学生人数"
                   style="width:150px;height: 50px"
                   disabled name="studentnum" value="{{ keshi_obj.studentnum }}">&nbsp;&nbsp;
            <label for="seatsnum">座位总数</label>&nbsp;
            <input type="text" class="form-control" id="seatsnum" placeholder="座位自动计算" style="width:150px;height: 50px"
                   disabled name="seatsnum" value="{{ keshi_obj.seatnum }}">
            <label for="btn_create">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
            <button type="submit" class="btn btn-success" id="btn_kq" style="width: 130px;height: 50px" name="">开始考勤
            </button>&nbsp;&nbsp;
        </div>
        <div class="form-group form-inline">
            <label for="qiandaonum">已签到人数</label>&nbsp;
            <input type="text" class="form-control" id="qiandaonum" placeholder="人数自动计算"
                   style="width:150px;height: 50px"
                   disabled name="qiandaonum" value="{{ yidaonum }}">&nbsp;&nbsp;
            <label for="weidaosnum">未签到人数</label>&nbsp;
            <input type="text" class="form-control" id="weidaosnum" placeholder="人数自动计算"
                   style="width:150px;height: 50px"
                   disabled name="weidaosnum" value="{{ weidaonum }}">
            <label for="qingjiasnum">请假人数</label>&nbsp;
            <input type="text" class="form-control" id="qingjiasnum" placeholder="人数自动计算"
                   style="width:150px;height: 50px"
                   disabled name="qingjiasnum" value="{{ qingjianum }}">
        </div>
        <br>
    </form>
    <br><br>
    <div class="panel panel-primary" style="clear: both">
        <div class="panel-heading">
            <h3 class="panel-title">课室查看</h3>
        </div>
    </div>
    <div class="form-group" style="height: 100%;width: 100%;background-color: #bfcbd9">
        <div style="background-color:#304156;font-size: 50px;height: 68px;width:100px;margin-left:45%">讲台</div>
    </div>
    <div class="form-group" style="height: 30px;width: 100%;background-color: #bfcbd9"></div>
    {% load static %}
    <div class="panel panel-info">

        <div class="col-md-12">
            {% for re in list1 %}
                <div style='width:130px;height:110px;margin:5px 5px;background-color: #f6f4ec'>
                    <div class="caption">
                        <img src="{% static 'img/devices.png' %}" alt="" id="{{ re }}"
                             style='width:110px;height:80px'>
                        <p>当前座位:{{ re|safe }}</p>
                    </div>
                </div>
            {% endfor %}
            <script>
                {% for re1 in kaoqin_obj %}
                    $('#{{re1.seatcoordinates}}').attr("src", "{{re1.avatar}}");
                {% endfor %}
            </script>
        </div>
    </div>
    <script>
        $('#btn_kq').click(function () {
            $.ajax({
                url: '/tea_admin/classmanage/',
                type: 'post',
                data: {
                    "class_select": $('#class_select').val(),
                    "course_select": $('#course_select').val()
                },
                success: function (args) {

                }
            })
        })
    </script>
    <button class="btn btn-primary" id="btn">Try me!</button>
    <script>
    $('#btn').click(function () {
                swal({
          title: "Are you sure?",
          text: "You will not be able to recover this imaginary file!",
          type: "warning",
          showCancelButton: true,
          confirmButtonClass: "btn-danger",
          confirmButtonText: "Yes, delete it!",
          cancelButtonText: "No, cancel plx!",
          closeOnConfirm: false,
          closeOnCancel: false
        },
        function(isConfirm) {
          if (isConfirm) {
            swal("Deleted!", "Your imaginary file has been deleted.", "success");
          } else {
            swal("Cancelled", "Your imaginary file is safe :)", "error");
          }
        });
    })
    </script>
{% endblock %}